package com.lagou.mr.nc;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;


public class NumberSortReducer extends Reducer<IntWritable, NullWritable, IntWritable, IntWritable> {

    int sort = 0;
    IntWritable resultKey = new IntWritable();

    @Override
    protected void reduce(IntWritable key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        sort ++;
        resultKey.set(sort);
        context.write(resultKey, key);
    }
}
